package com.team.mpc.service.mq;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
//consumeMode消费模式  有序，无序 messageModel消息模式 广播（消费者组内所有消费者都需要消费） 集群（消费者组内仅有一个消费者可以消费）  已经实现消费事务
@RocketMQMessageListener(consumerGroup = "consumer",topic = "my-topic",consumeMode = ConsumeMode.CONCURRENTLY,messageModel = MessageModel.CLUSTERING)
public class DemoConsumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String s) {
      log.info(s);
    }
}
